<?php

/**
 * Article form base class.
 *
 * @method Article getObject() Returns the current form's model object
 *
 * @package    frigospeed
 * @subpackage form
 * @author     0
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseArticleForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'commande_id' => new sfWidgetFormInputHidden(),
      'produit_id'  => new sfWidgetFormInputHidden(),
      'quantite'    => new sfWidgetFormInputText(),
      'prix_vente'  => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
		  'commande_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Commande'))),
      'produit_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Produit'))),
      'quantite'    => new sfValidatorInteger(),
      'prix_vente'  => new sfValidatorNumber(),
    ));

    $this->widgetSchema->setNameFormat('article[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Article';
  }

}
